Whilst the Raspberry Pi RP2040 is quite a capable little chip, on the whole it’s nothing really special compared to the big brand offerings. But, the PIO peripheral is a bit special, and its inclusion was clearly a masterstroke of foresight, because it has bestowed the platform all kinds of capabilities that would be really hard to do any other way, especially for the price.
Our focus this time is on Ethernet, utilizing the PIO as a simple serialiser to push out a pre-formatted bitstream. [kingyo] so far has managed to implement the Pico-10BASE-T providing the bare minimum of UDP transmission (GitHub project) using only a handful of resistors as a proof of concept. For a safer implementation it is more usual to couple such a thing magnetically, and [kingyo] does show construction of a rudimentary pulse transformer, although off the shelf parts are obviously available for this. For the sake of completeness, it is also possible to capacitively couple Ethernet hardware (checkout this Micrel app note for starters) but it isn’t done all that much in practice.
UDP is a simple Ethernet protocol for transferring application data. Being connection-less, payload data are simply formatted into a packet buffer up front. This is all fine, until you realize that the packets are pretty long and the bitrate can be quite high for a low-cost uC, which is why devices with dedicated Ethernet MAC functionality have a specific hardware serialiser-deserialiser (SERDES) block just for this function.
Like many small uC devices, the RP2040 does not have a MAC function built in, but it does have the PIO, and that can easily be programmed to perform the SERDES function in only a handful of lines of code, albeit only currently operating at 10 MBit/sec. This will cause some connectivity problems for modern switch hardware, as they will likely no longer support this low speed, but that’s easily solved by snagging some older switch hardware off eBay.
As for the UDP receive, that is promised for the future, but for getting data out of a remote device over a wired network, Pico-10BASE-T is a pretty good starting point. We’ve seen a few projects before that utilize the PIO to generate high speed signals, such as DVI, albeit with a heavy dose of overclocking needed. If you want a bit more of an intro to all things Pico, you could do worse than check out this video series we highlighted a while back.
So, it isimple, TX only, but doesn’t the transmitting CPU need some form of ACK?
UDP doesn’t use ACKs
Only if it has a frog in it’s throat.
I would tell you a joke about UDP, but you probably wouldn’t get it, and I wouldn’t care.
UDP just doesn’t bake retry logic into the protocol, the way TCP does – it’s on you to handle that at the application layer if you need it. Which is why TCP is so heavily favored, as much of the time you do want that feature and don’t want to reinvent the wheel.
But UDP is massively overlooked, probably often due to a creeping suspicion of it being unreliable. Sure, if you’re trying to move data from say San Francisco to Mumbai, there are a zillion possible paths, with probably 30 hops on every one of them, stuff happens and packets can disappear on the way. This shouldn’t be construed as UDP itself being unreliable so much as long haul internet connection is unreliable. If you’re just trying to move data from one side of your lab to the other, or even across your office building, there usually isn’t more than about one way to go and there’s no excuse for any decent switch or router to throw away datagrams on a whim.
Some people made a full ethernet (just require PHY) with Pico : https://github.com/sandeepmistry/pico-rmii-ethernet
There is no need to buy an old Ethernet switch off of Ebay. All Ethernet switches with RJ45 ports support 10 Mbits operation.
10 gigabit Ethernet switches generally do not support 10 megabit Ethernet.
The legendary CNLohr did RX/TX ethernet on an ATTiny85 :D
Unfortunately CNLohr has been swallowed by VRChat
That’s sad to hear :(
Just did a quick check, and yep, he’s gone DEEP into the rabbit hole that VR obsessed people do.
And I’m actually being nice since I merely say obsessed.
> UDP is a simple Ethernet protocol for transferring application data.
UDP is a simple IP protocol for transferring application data. Through clever hackery, [kingyo] has bit-banged the minimum Layer 2 Ethernet and Layer 3 UDP/IP communication stack necessary for transmitting UCP/IP packets as Ethernet frames onto the nearest network switch.
Please be kind and respectful to help make the comments section excellent. (Comment Policy)
This site uses Akismet to reduce spam. Learn how your comment data is processed.
By using our website and services, you expressly agree to the placement of our performance, functionality and advertising cookies. Learn more